package com.example.test1.presenter;

import com.example.test1.http.Api;
import com.example.test1.moudle.Main_Moudle;
import com.example.test1.view.Main_View;

import okhttp3.RequestBody;

/**
 * Created by 段傅华 on 2018/12/12.
 */

public class Presenter implements Main_Presenter, Main_Moudle.Finish {
    private Main_Moudle mMain_moudle;
    private Main_View mMain_view;

    public Presenter(Main_Moudle main_moudle, Main_View main_view) {
        mMain_moudle = main_moudle;
        mMain_view = main_view;
    }

    @Override
    public void getData(String url, RequestBody requestBody, Api api) {
        if (mMain_view!=null){
            mMain_moudle.setdata(url,requestBody,api,this);
        }
    }

    @Override
    public void setSuccess(Object o, Api api) {
        if (mMain_view!=null){
            mMain_view.ShowSuccess(o,api);
        }
    }

    @Override
    public void setError(String error) {
        if (mMain_view!=null){
            mMain_view.ShowError(error);
        }
    }
}
